<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<!-- saved from url=(0041)https://www.zretc.net/classrooms/personal -->
<html>
<head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

    <title>GO运动</title>

    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
    <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover"> -->
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <!-- <script type="text/javascript" data-framework src="/webApp/js/common/raven.min.js" crossorigin="anonymous"></script> -->


    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/elementui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/elements.css" >
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/train_banner_429adde.css" >
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/components_9031f76.css" >
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/personal_nav_5b79317.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/classroom_a85a9c7.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/iconfont.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/common_dbbbd09.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/lineariconss.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/bootstraps.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/mains.css">
    <script  src="${pageContext.request.contextPath}/style/js/bootstrap.js"></script>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/style/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/style/css/dashboard.css">

    <style type="text/css">
        [v-cloak] {
            display: none;
        }

        .training_activity_list_header {
            background-image:url(${pageContext.request.contextPath}/style/images/ct.jpg);
            background-repeat: no-repeat;
            background-size:  1140px 100%;
            background-position:140px 0px ;
        }

        th{
            text-align: center;
            width: 200px;
        }
        td{
            text-align: center;
            height: 60px;
        }
    </style>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/style/css/main_269e229.css">
</head>
<body>
<div id="app" style="position: relative; min-height: calc(100vh - 195px);">
    <div class="header_box">
        <header id="header">
            <div class="ascend"></div>
            <div class="container main-menu">
                <div class="row align-items-center justify-content-center">
                    <nav id="nav-menu-container">
                        <ul class="nav-menu">
                            <li class="menu-active"><a href="${pageContext.request.contextPath}/page/index1.jsp">首页</a></li>
                            <li><a href="${pageContext.request.contextPath}/actionlibrary/actionlibrary.jsp">健身课程库</a></li>
                            <li><a href="${pageContext.request.contextPath}/page/services.jsp">特设课堂</a></li>
                            <li><a href="${pageContext.request.contextPath}/page/trainers.jsp">图库</a></li>
                            <li class="menu-has-children"><a href="">更多</a>
                                <ul>
                                    <li><a href="${pageContext.request.contextPath}/page/blog-home.jsp">我的收藏</a></li>
                                    <li><a href="${pageContext.request.contextPath}/page/blog-single.jsp">我的关注</a></li>
                                </ul>
                            </li>
                            <li><a href="${pageContext.request.contextPath}/page/elements.jsp">联系我们</a></li>
                            <li><a href="${pageContext.request.contextPath}/page/contact.jsp">关于我们</a></li>
                            <li>


                                <div class="item-group" id="me">

                                </div>
                            </li>
                        </ul>
                    </nav><!-- #nav-menu-container -->
                </div>
            </div>
        </header><!-- #header -->
    </div>
    <main style="padding-top: 0px">
        <header>
            <div class="training_activity_list_header" />
            <div class="training_activity_list_header_ware"></div>
            <div class="training_activity_list_userinfo"><img src="${pageContext.request.contextPath}/FileDownloadServlet?fileName=${sessionScope.user.userImg}"
                                                              onerror='this.src="${pageContext.request.contextPath}/style/images/titlel.jpg"'  class="training_activity_list_portrait">
                <div class="training_activity_list_nickname left">${sessionScope.user.userName}</div>
                <c:if test="${sessionScope.user.vipState == '1'}">
                    <img src="${pageContext.request.contextPath}/style/images/vip.png" style="height: 15px;position: relative;top: 36px;right: 135px;">
                </c:if>
            </div>
        </header>
        <article>
            <div class="training_activity_list_main clearfix">
                <div class="personalNav">
                    <ul>
                        <li class="checkon"><a href="${pageContext.request.contextPath}/frontbg/CenTer.jsp"
                                               class="co_333"><span class="iconfont icon-teach p_ibm Mrt20 Mlf30"></span>
                            <span>用户管理</span></a></li>
                        <li><a href="${pageContext.request.contextPath}/frontbg/VideoCenTer.jsp" class="co_333"><span
                                class="iconfont icon-homework p_ibm Mrt20 Mlf30"></span>
                            <span>视频管理</span></a></li>
                        <li><a href="${pageContext.request.contextPath}/frontbg/PublishVideo.jsp" class="co_333"><span
                                class="iconfont icon-play p_ibm Mrt20 Mlf30"></span> <span>上架视频</span></a>
                        </li>
                        <li id="exitUser"><a href="#" class="co_333"><span
                                class="iconfont icon-setup p_ibm Mrt20 Mlf30"></span>
                            <span>退出登入</span></a></li>

                    </ul>
                </div>
                <div class="training_activity_list_detailed">
                    <div class="training_activity_list_detailed_nav clearfix">
                        <ul class="left">
                            <li class="active">已发布</li>
                        </ul>
                    </div>
                    <div class="Mtp20">
                        <table class=" table-striped">
                            <thead>
                            <tr><td><title></title></td></tr>
                            <tr>
                                <th>用户名</th>
                                <th>用户头像</th>
                                <th>用户状态</th>
                                <th>用户权限</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody id="show">

                            </tbody>
                        </table>
                        <div id="showPageInfo" class="col-md-12 text-center" style="position: absolute; left: 130px;"></div>
                        <div class="col-md-12 text-center"  style="position: absolute;left:130px;">
                            <ul class="pagination pagination-lg" id="pageItem">
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </article>
    </main>
</div>

<script type="text/javascript" data-loader="" src="${pageContext.request.contextPath}/style/js/config_b47c63a.js"></script>
<script type="text/javascript" data-loader="" src="${pageContext.request.contextPath}/style/js/jquery.min.js"></script>
<script type="text/javascript" data-loader="" src="${pageContext.request.contextPath}/style/js/remoteCall_77ab826.js"></script>
<script type="text/javascript" data-loader="" src="${pageContext.request.contextPath}/style/js/lodash.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/style/js/vue_63f7cd8.js"></script>
<script type="text/javascript" data-loader="" src="${pageContext.request.contextPath}/style/js/util_fad37ea.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/style/js/elementui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/style/js/train_banner_66263da.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/style/js/components_52f8782.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/style/js/personal_nav_be8c381.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/style/js/classroom_63b138d.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/style/js/personal_87e9220.js"></script>
<div class="login_bomb_box" style="display: none;">
    <div class="login_bomb_cancel"></div>
    <div class="wisdom_login posf border1">
        <div class="posa" style="width: 110px; top: -50px; left: 106px;"><img
                src="${pageContext.request.contextPath}/style/images/userName.png" alt="" class="wido100"></div>
        <div class="posa" style="width: 110px; top: -50px; left: 106px; display: none;"><img
                src="${pageContext.request.contextPath}/style/images/pwd.png" alt="" class="wido100"></div>
        <div class="input_text Mtp30 posr"><input type="text" placeholder="手机号" class="F14"> <span
                class="posa co_798f9c iconfont icon-username"></span> <span class="posa iconfont icon-close"
                                                                            style="display: none;"></span></div>
        <div class="input_password Mtp25 posr"><input type="password" placeholder="密码" class="F14"> <span
                class="posa co_798f9c iconfont icon-password"></span> <span class="posa iconfont icon-close"
                                                                            style="display: none;"></span></div>
        <div class="Mtp20"><input id="remember" type="checkbox" class="p_ibm Mrt5 Mlf15"
                                  style="width: 16px; height: 16px;"> <label for="remember" class="F12 co_526e7a">记住密码</label> <a
                target="_top"
                href="http://user.futurelab.tv/#/UserCenterLogin?platformCode=ZHJXY&amp;redirectUrl=https%3A%2F%2Fwww.zretc.net%2Fclassrooms%2Fpersonal"
                class="right co_09f F12">联合登录&gt;&gt;</a></div> <input type="button" value="登录"
                                                                       class="login_btn Mtp25 F16 Center">
        <button style="position: relative;left: 20px;border:none;"></button>
    </div>
</div>
<script>
    document.write('<script src="//' + (location.host || 'localhost').split(':')[0] +
        ':35929/livereload.js?snipver=1"></' + 'script>')
</script>
<script src="//127.0.0.1:35929/livereload.js?snipver=1"></script>

<script type="text/javascript">
    $(function () {
        $.get("${pageContext.request.contextPath}/AdminController/getQueryAllUser",{},function (data) {
            showData(data)
        })

        /*
				点击跳转页数
			*/
        $(document).on ("click",".jump",function () {
            $.get("${pageContext.request.contextPath}/AdminController/getQueryAllUser", {pageNo:this.getAttribute("value")}, function (data) {
                showData(data);
            })
        })

        /*
           输入页数跳转
       */
        $(document).on ("click","#jumpPage",function () {
            var pageNo = parseInt($("#jumpPageText").val());
            if( pageNo < 1 ) {
                pageNo = 1;
            } else if(pageNo > $("#totalPage").text()*1) {
                pageNo = $("#totalPage").text();
            }
            $.get("${pageContext.request.contextPath}/AdminController/getQueryAllUser", { pageNo:pageNo}, function (data) {
                showData(data);
            })
        })

        /*
			* 退出登入
			* */
        $("#exitUser").click(function () {
            var leep = confirm("确认退出");

            if(leep) {
                $.get("${pageContext.request.contextPath}/HistoryPersonageController/deleteHistoryByVideoId", function (data) {

                    location.href="${pageContext.request.contextPath}/front/UpdateInfo.jsp";
                })
            }
        })

        $(document).on("click",".asdas",function () {
            var userlever = $(this).attr("data-userLevel");
            var userState = $(this).attr("data-userState");
            if (userlever == "1") {
                alert("无权限");
            } else {
                if (userState == 1) {
                    var leep = confirm("是否确认注销用户");
                    if(leep) {
                        $.get("${pageContext.request.contextPath}/AdminController/deleteUser",{userId:$(this).attr("data-userid"),userState:0},function (data) {
                            if(data) {
                                $.get("${pageContext.request.contextPath}/AdminController/getQueryAllUser",{},function (data) {
                                    showData(data)
                                })
                            } else {
                                alert("注销失败");
                            }
                        })
                    }
                } else {
                    alert("用户已注销")
                }

            }
        })

        $(document).on("click",".updateBth",function () {
            var userlever = $(this).attr("data-userLevel");
            var userState = $(this).attr("data-userState");
            if (userlever == "1") {
                alert("无权限");
            } else {
                if (userState == 0) {
                    var leep = confirm("是否恢复用户");
                    if(leep) {
                        $.get("${pageContext.request.contextPath}/AdminController/deleteUser",{userId:$(this).attr("data-userid"),userState:1},function (data) {
                            if(data) {
                                $.get("${pageContext.request.contextPath}/AdminController/getQueryAllUser",{},function (data) {
                                    showData(data)
                                })
                            } else {
                                alert("恢复失败");
                            }
                        })
                    }
                } else {
                    alert("用户为正常状态")
                }

            }
        })
    })

    function showData(result){
        //每一次遍历之前需要清空
        $("#show").empty();
        $("#pageItem").empty();
        $("#showPageInfo").empty();
        //显示文章列表数据
        $.each(result.list,function(index,user){
            $("#show").append("<tr>\r\n" +
                "		              <td>"+ user.userName +"</td>\r\n" +
                "		              <td ><img src='${pageContext.request.contextPath}/FileDownloadServlet?fileName=" + user.userImg + "' style=\'height: 40px\'></td>\r\n" +
                "		              <td>" + (user.userState == 1 ? "正常":"注销") +"</td>\r\n" +
                "		              <td>"+ (user.userLevel == 1 ? "管理员":"普通用户") +"</td>\r\n" +
                "		              <td><button id='updateBth' class=\'btn btn-warning btn-sm updateBth\' data-userid='" + user.userId +"'  data-userLevel=" + user.userLevel +" data-userState=" + user.userState +">修改</button>&nbsp;&nbsp;\r\n" +
                "		              	  <button data-userState=" + user.userState +" data-userLevel=" + user.userLevel +"  data-userid=" + user.userId +" class=\'btn btn-danger btn-sm asdas\' >注销</button></td>\r\n" +
                "		            </tr>")
        })

        if (result.list == '') {
            $("#show").append('<img src="${pageContext.request.contextPath}/style/images/no_data.png" style="height: 175px;position: relative;top: 50px;left: 270px;">');
            $("#show").append('<div class="prom_txt" style="position: relative;left: 240px;top: 40px">还没有用户,快去推广项目吧！</div>');
            return;
        }
        //显示分页信息
        $("#showPageInfo").append("当前第<span id='pageNo'>" + result.pageNum +
            "</span>页/共<span id='totalPage'>"+result.pages +
            "</span>页/当前页显示<span id='pageSize'>"+result.size+
            "</span>条/共<span id='totalCount'>"+result.total +"</span>条");
        //分页栏
        //首页
        if(1==result.pageNum){
            $("#pageItem").append('<li class="disabled"><a class="jump" value="1">首页</a></li>');
        }else{
            $("#pageItem").append('<li><a class="jump" value="1">首页</a></li>');
        }
        //上一页
        if("1"==result.pageNum){
            $("#pageItem").append('<li class="disabled"><a class="jump" value="'+(result.pageNum)+'">上一页</a></li>');
        }else{
            $("#pageItem").append('<li><a class="jump" value="'+(result.pageNum-1)+'">上一页</a></li>');
        }
        //分页栏目
        for(var i=1;i<=result.pages;i++){
            if(i==result.pageNum){
                $("#pageItem").append('<li class="active"><a class="jump" value="'+i+'">'+i+'</a></li>');
            }else{
                $("#pageItem").append('<li><a class="jump" value="'+i+'">'+i+'</a></li>');
            }
        }
        //下一页
        if(result.pages==result.pageNum){
            $("#pageItem").append('<li class="disabled"><a class="jump" value="'+(result.pageNum)+'">下一页</a></li>');
        }else{
            $("#pageItem").append('<li><a class="jump" value="'+(result.pageNum+1)+'">下一页</a></li>');
        }
        //末页
        if(result.pages==result.pageNum){
            $("#pageItem").append('<li class="disabled"><a id="last" class="jump" value="'+result.pages+'">末页</a></li>');
        }else{
            $("#pageItem").append('<li><a class="jump" value="'+result.pages+'">末页</a></li>');
        }
        //跳转页
        $("#pageItem").append('<li><a><input id="jumpPageText" style="height:20px;width:45px" type="number" min="1" max="'+result.pages+'"></a></li>');
        $("#pageItem").append('<li><a id="jumpPage">跳转</a></li>');
    }
</script>
</body>

</html>
